From: kfraser@localhost.localdomain Date: Mon, 10 Sep 2007 15:13:35 +0000 (+0100) Subject: vmx: Sync with SVM TPR/CR8 changes. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14984^2~3 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=840348501b10e4ccc1f266349c32faadd7e5b945;p=xen.git vmx: Sync with SVM TPR/CR8 changes. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c index 60fdf529fa..352b9111ea 100644 --- a/xen/arch/x86/hvm/vmx/intr.c +++ b/xen/arch/x86/hvm/vmx/intr.c @@ -107,22 +107,35 @@ static void enable_intr_window(struct vcpu *v, enum hvm_intack intr_source) } } -static void update_tpr_threshold(struct vlapic *vlapic) +static void update_tpr_threshold( + struct vcpu *v, enum hvm_intack masked_intr_source) { - int max_irr, tpr; + struct vlapic *vlapic = vcpu_vlapic(v); + int max_irr, tpr, threshold = 0; if ( !cpu_has_vmx_tpr_shadow ) return; + /* + * If ExtInts are masked then that dominates the TPR --- the 'interrupt + * window' has already been enabled in this case. + */ + if ( (masked_intr_source == hvm_intack_lapic) || + (masked_intr_source == hvm_intack_pic) ) + goto out; + + /* Is there an interrupt pending at the LAPIC? Nothing to do if not. */ if ( !vlapic_enabled(vlapic) || ((max_irr = vlapic_find_highest_irr(vlapic)) == -1) ) - { - __vmwrite(TPR_THRESHOLD, 0); - return; - } + goto out; + /* Highest-priority pending interrupt is masked by the TPR? */ tpr = vlapic_get_reg(vlapic, APIC_TASKPRI) & 0xF0; - __vmwrite(TPR_THRESHOLD, (max_irr > tpr) ? (tpr >> 4) : (max_irr >> 4)); + if ( (tpr >> 4) >= (max_irr >> 4) ) + threshold = max_irr >> 4; + + out: + __vmwrite(TPR_THRESHOLD, threshold); } asmlinkage void vmx_intr_assist(void) @@ -171,7 +184,7 @@ asmlinkage void vmx_intr_assist(void) enable_intr_window(v, intr_source); out: - update_tpr_threshold(vcpu_vlapic(v)); + update_tpr_threshold(v, intr_source); } /*